﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Media;

namespace WpfClient
{
    public class RatingToColorConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value is int)
            {
                var rating = (int)value;
                if (rating < 0)
                {
                    return new SolidColorBrush(Colors.Red);
                }
                else if (rating == 0)
                {
                    return new SolidColorBrush(Colors.Gray);
                }
                else if (rating > 0)
                {
                    return new SolidColorBrush(Colors.Green);
                }
            }

            return null;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
